const Mock = require('mockjs');

const Random = Mock.Random;
import countryList from '../assets/js/country.js';
const configData = function (opt) {
  // console.log('opt,'+opt)
  let list = [{
    type: 'text',
    key: 'name',
    value: '',
    label: '姓名',
    placeholder: '请输入真实姓名',
    must: true,
    readonly: false,
    disabled: false
  }, {
    type: 'text',
    key: 'phone',
    value: '',
    label: '手机',
    placeholder: '请输入手机号码',
    must: true,
    readonly: false,
    disabled: false
  }, {
    type: 'code',
    key: 'code',
    value: '',
    label: '验证码',
    placeholder: '请输入验证码',
    must: true,
    readonly: false,
    disabled: false
  }, {
    type: 'picker',
    key: 'country',
    value: '',
    label: '国家地区',
    placeholder: '请选择国家或地区',
    must: true,
    readonly: true,
    disabled: false,
    data: countryList.list
  }, {
    type: 'area',
    key: 'area',
    value: '',
    label: '省市区',
    placeholder: '请选择省市区',
    must: true,
    readonly: true,
    disabled: false,
    cols: 3, // 2-选择省市，3-选择省市区
    title: '选择省市区'
  }, {
      type: 'upload',
      key: 'upload',
      value: '',
      label: '上传图片',
      must: true,
      accept: 'image/*',
      maxlength: 1048576
  }];
  return list;
};

const tickets = function() {
  let list = [{
    ID: 'ticket01',
    TicketName: '票种01',
    Fee: '19.9',
    Num: 500,
    RealNum: 218,
    Sort: 1,
    BuyNum: 10,
    SingleBuyNum: 2,
    ParallelSessions: '分会场1',
    Time: '2018-11-29',
    Category: '嘉宾'
  }, {
    ID: 'ticket02',
    TicketName: '票种02',
    Fee: '29.9',
    Num: 300,
    RealNum: 300,
    Sort: 2,
    BuyNum: 20,
    SingleBuyNum: 0,
    ParallelSessions: '分会场2',
    Time: '2018-11-30',
    Category: '观众'
  }];
  return list;
};
Mock.mock('/api/config', /post|get/i, configData);
Mock.mock('/api/tickets', /post|get/i, tickets);
